package test4;

import test3.Student;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("stream-test\\test3_4.txt"));

        List<Student> list = new ArrayList<>();
        String str;
        while ((str = br.readLine()) != null) {
            String[] split = str.split(",");
            Student stu = new Student();
            stu.setName(split[0]);
            stu.setGener(split[1]);
            stu.setAge(Integer.parseInt(split[2]));
            stu.setScore(Integer.parseInt(split[3]));
            list.add(stu);
        }
        for (Student student : list) {
            System.out.println(student);
        }
    }
}
